# -*- coding:utf-8 -*-
# @FileName  :login.py
# @Time      :2022/12/21 14:08
# @Author    :凉柠
# @E-main    :1075090027@qq.com
from django.http import JsonResponse
from django.contrib.auth import authenticate,login

def signin(request):
    data = request.GET
    username = data.get('username')
    password = data.get('password')
    user = authenticate(username=username,password=password)
    if not user:
        return JsonResponse({
            'result':"用户名或密码不正确",
        })
    login(request,user)
    return JsonResponse({
        'result':"success"
    })